<template>
    <div class="app-container">
        <!-- 全款项目流水单信息 -->
        <h5 class="titleInfo">
            全款项目流水单信息
        </h5>
        <el-form ref="list" :inline="true" :model="list" label-width="130px">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="流水单号">
                        <span class="spanToInput">{{list.orderSn | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="预约单号">
                        <span class="spanToInput">{{list.preOrderSn | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="订单号">
                        <span class="spanToInput">{{list.projectOrderSn | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="流水单类型">
                        <span class="spanToInput">{{list.type | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="预约医院">
                        <span class="spanToInput">{{list.hospitalName | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <!-- <el-col :span="12">
                    <el-form-item label="单数">
                        <span class="spanToInput">{{list.num | filterNull}}</span>
                    </el-form-item>
                </el-col> -->
                <el-col :span="12">
                    <el-form-item label="创建日期">
                        <span class="spanToInput">{{list.createdAt | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="刷卡日期">
                        <span class="spanToInput">{{list.orderTime | filterNull}}</span>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <!-- 人员信息 -->
        <div class="divBar"></div>
        <h5 class="titleInfo">
            人员信息
        </h5>
        <el-form ref="list" :inline="true" :model="list" label-width="130px">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="客户姓名">
                        <span class="spanToInput">{{list.userName | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="客户手机号">
                        <span class="spanToInput">{{list.userPhone | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="推荐人姓名">
                        <span class="spanToInput">{{list.serviceName | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="推荐人手机号">
                        <span class="spanToInput">{{list.servicePhone | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="团队姓名">
                        <span class="spanToInput">{{list.teamUserName | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="团队手机号">
                        <span class="spanToInput">{{list.teamUserPhone | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="管家姓名">
                        <span class="spanToInput">{{list.butlerRealname | filterNull}}</span>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="管家手机号">
                        <span class="spanToInput">{{list.butlerUsername | filterNull}}</span>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <!-- 支付信息 -->
        <div class="divBar"></div>
        <h5 class="titleInfo">
            支付信息
        </h5>
        <el-form ref="list" :inline="true" :model="list" label-width="130px">
            <el-row>
        <!-- orderSource == 1 || orderSource == 2，属于卡券项目 -->
                <div v-if="list.orderSource == 1 || list.orderSource == 2">
                    <el-col :span="12">
                        <el-form-item label="消费总金额">
                        <span class="spanToInput">{{list.totalPrice | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="实付扣除杂费">
                        <span class="spanToInput">{{list.allPrice | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="平台已支付现金">
                        <span class="spanToInput">{{list.platformMoney | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="金币">
                        <span class="spanToInput">{{list.goldCoin | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                </div>
                <div v-else>
                    <el-col :span="8">
                        <el-form-item label="项目价格">
                            <span class="spanToInput">{{list.projectPrice | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="实付金额">
                            <span class="spanToInput">{{list.totalPrice | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="总抵扣积分">
                            <span class="spanToInput">{{list.deductionCredit | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="活动积分">
                            <span v-if="list.creditJson" class="spanToInput">{{list.creditJson.credit | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="可提现积分">
                            <span v-if="list.creditJson" class="spanToInput">{{list.creditJson.coin | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="消费积分">
                            <span v-if="list.creditJson" class="spanToInput">{{list.creditJson.usableCredit | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                    <el-col :span="24">
                        <el-form-item label="可消费额度积分">
                            <span v-if="list.creditJson" class="spanToInput">{{list.creditJson.waitCredit | filterNull}}</span>
                        </el-form-item>
                    </el-col>
                </div>
                <el-col :span="12" style="margin-top:20px;">
                    <el-form-item label="支付凭证">
                        <uploadImg
                        ref="uploadImg"
                        :disabled="$route.name == 'runWaterManFullInfo'"
                        :file-num="fileNum"
                        :file-list="fileList"
                        />
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="备注">
                        <span class="spanToInput">{{list.userRemark | filterNull}}</span>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
    </div>
</template>
<script>
    import uploadImg from "@/components/UploadImg/index";
    import { policy } from '@/api/policy'
    import { getBeautyProjectOrderById } from '@/api/runWaterManage' 
    export default {
        name:"runWaterManFullInfo",
        components: { uploadImg },
        data(){
            return {
                userId:"",
                list:{},
                fileNum: 3,
                fileList: []
            }
        },
        filters:{
            filterNull(e) {
                if(e==0){
                    return "0"
                }else{
                    if(!e){
                        return "暂无"
                    }else{
                        return e
                    }
                }
            },
            imgFilter(e){
                return localStorage.getItem("imgUrlPrefix")+e
            },
            cardNull(e){
                return window.helper.cardType(e)
            },
            userFocus(e){
                return window.helper.userFocus(e)
            }
        },
        mounted(){
            this.userId = String(this.$route.query.userId)
            this.getList()
        },
        methods:{
            getList(){
                let datas = {id:this.userId}
                getBeautyProjectOrderById(datas).then().then(res =>{
                    console.log(res)
                    if(!res.data.code){
                        this.list = res.data.data
                        this.list.img.forEach(i => {
                            this.fileList.push({
                                url: localStorage.getItem("imgUrlPrefix") + i
                            });
                        });
                    }else{
                        this.$message.error(res.data.msg);
                    }
                })
                .catch(error =>{
                    this.$message.error(error);
                })
            },
        }
    }
</script>

<style scoped>
    .app-container{padding: 0px!important}
    .form{margin-left: 268px}
</style>